/// 高德地图API Key配置类
///
/// 用于配置不同平台的API Key
class AMapApiKey {
  /// Android平台的API Key
  final String? androidKey;

  /// iOS平台的API Key
  final String? iosKey;

  /// 鸿蒙平台的API Key
  final String? ohosKey;

  /// 构造函数
  const AMapApiKey({
    this.androidKey,
    this.iosKey,
    this.ohosKey,
  });

  /// 转换为Map格式
  Map<String, dynamic> toMap() {
    return {
      'androidKey': androidKey,
      'iosKey': iosKey,
      'ohosKey': ohosKey,
    };
  }

  /// 从Map创建实例
  factory AMapApiKey.fromMap(Map<String, dynamic> map) {
    return AMapApiKey(
      androidKey: map['androidKey'] as String?,
      iosKey: map['iosKey'] as String?,
      ohosKey: map['ohosKey'] as String?,
    );
  }

  @override
  bool operator ==(Object other) {
    if (identical(this, other)) return true;
    return other is AMapApiKey && other.androidKey == androidKey && other.iosKey == iosKey && other.ohosKey == ohosKey;
  }

  @override
  int get hashCode => androidKey.hashCode ^ iosKey.hashCode ^ ohosKey.hashCode;

  @override
  String toString() {
    return 'AMapApiKey(androidKey: $androidKey, iosKey: $iosKey, ohosKey: $ohosKey)';
  }
}
